package cn.bdqn.dao;

import cn.bdqn.pojo.Announcement;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Author: 苏闻君
 * @Date: Created in 2020/7/18  15:15
 * 公告接口
 */
@Mapper
public interface AnnounceDaok {
    /**
     * 查询公告
     */
    @Select("select * from announcement limit 3")
    List<Announcement> selectAnn();

    /**
     * 查询公告详细信息
     * @return
     */
    @Select("select * from announcement where id=#{id}")
    Announcement selectDet(Integer id);

    /**
     * 查询公告类型
     * @return
     */
    @Select("SELECT id,TYPE FROM announcement LIMIT 3")
    List<Announcement> selectType();

    /**
     * 根据类型查询公告
     * @return
     */
    @Select("SELECT * FROM announcement WHERE details  LIKE concat('%',#{type,jdbcType=VARCHAR},'%') LIMIT 1")
    Announcement selectGonggao(String type);


}
